from openai import OpenAI
from langchain.chat_models import ChatOpenAI
from langchain.schema import SystemMessage,HumanMessage

# from langchain.llms import OpenAI
# llm = OpenAI("gpt-3.5-turbo")
# gpt-3.5-turbo

client = OpenAI(
    api_key='hk-mtiquv1000041663a49a34520ad3294132cbce7abf1c2ef3',
    base_url="https://api.openai-hk.com/v1"
)
# chat = ChatOpenAI(api_key='hk-mtiquv1000041663a49a34520ad3294132cbce7abf1c2ef3',
#     base_url="https://api.openai-hk.com/v1")

response = client.completions.create(
    model="gpt-3.5-turbo",
    prompt=['你是谁？','你能给我什么帮助？'],
    max_tokens=2048
)
print(response)
print(response['choices'][0]['text'])
# completion = client.chat.completions.create(
#     model="gpt-3.5-turbo",
#     messages=[{"role": "user", "content": "用七言绝句的形式写一首关于学习的诗"}]
# )
#
# print(completion.choices[0].message.content)